﻿<%@ Page Title="" Language="C#" MasterPageFile="~/AdminCP/AdminTemplate.Master" AutoEventWireup="true" CodeBehind="ManageAdvertisements.aspx.cs" Inherits="RealtorsPortal.Advertisements" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <title>Advertisements management</title>
    <script type="text/javascript" language="javascript" src='<%=ResolveUrl("~/scripts/jquery.js") %>'></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <fieldset>
        <div>
            <fieldset>
                <h2>Manage Advertisements</h2>
            </fieldset>
            <asp:GridView ID="grvManageAdver" runat="server" AutoGenerateColumns="False" Width="100%" AllowPaging="True" PageSize="5" DataKeyNames="AdvId" OnRowCommand="grvManageAdver_RowCommand" OnPageIndexChanging="grvManageAdver_PageIndexChanging">
                <HeaderStyle CssClass="header_gridview" />
                <Columns>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:CheckBox runat="server" ID="chkAdvertisements" />
                        </ItemTemplate>
                        <HeaderTemplate>
                            <%--<asp:CheckBox runat="server" ID="chkSelectAll" />--%>
                            <input id="chkSelectAll" onclick="javascript: SelectAllCheckboxes(this);" runat="server" type="checkbox" />
                        </HeaderTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Title">
                        <ItemTemplate>
                            <%#Eval("Title")%>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Type">
                        <ItemTemplate>
                            <%#Eval("Type")%>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Price">
                        <ItemTemplate>
                            <%#Eval("Price")%>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="IsActive">
                        <ItemTemplate>
                            <asp:CheckBox ID="chkActive" runat="server" Checked='<%#Convert.ToBoolean(Eval("IsActive"))%>' />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="View">
                        <ItemTemplate>
                            <asp:LinkButton ID="lbtnBrowse" runat="server" CommandName="BrowseComponent"
                                ValidationGroup="browse" CausesValidation="True"
                                CommandArgument='<%# DataBinder.Eval(Container, "RowIndex") %>'>
                                <asp:Image ID="ibtnBrowse" runat="server" ImageUrl="assets/b_browse.png" />
                            </asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
            <asp:DropDownList ID="ddlPageMana" runat="server" AutoPostBack="true">
                <asp:ListItem>5</asp:ListItem>
                <asp:ListItem>10</asp:ListItem>
                <asp:ListItem>20</asp:ListItem>
            </asp:DropDownList>
        </div>
        <div class="input_field no_margin_bottom">
            <label>
                &nbsp;</label>
            <asp:Button ID="btnDeleteSelected" runat="server" Text="DELETE SELECTED" CssClass="submit" OnClick="btnDeleteSelected_Click"/>
        </div>
    </fieldset>
    <script language="javascript" type="text/javascript">
        function SelectAllCheckboxes(chk) {
            $('#<%=grvManageAdver.ClientID%>').find("input:checkbox").each(function () {
                if (this != chk) { this.checked = chk.checked; }
            });
        }

        function Confirmationbox() {
            var result = confirm('Are you sure you want to delete selected advertises(s)?');
            if (result) {
                return true;
            }
            else {
                return false;
            }
        }
    </script>
</asp:Content>
